#include "reg52.h"

sfr AUXR = 0x8e;

void SendByte(unsigned char dat);

unsigned char urdat;
void InitUart()
{
	SCON = 0x50;		//8???,?????
	AUXR |= 0x40;		//???1???Fosc,?1T
	AUXR &= 0xFE;		//??1?????1???????
	TMOD &= 0x0F;		//?????1?16???????
	TL1 = 0xE0;		//??????
	TH1 = 0xFE;		//??????
	ET1 = 0;		//?????1??
	TR1 = 1;
	
	ES=1;
	EA=1;
													  
}

void ServiceUart() interrupt 4
{
	if(RI==1)
	{
		RI=0;
		urdat=SBUF;
		SendByte(urdat+1);
	}
}

void SendByte(unsigned char dat)
{
	SBUF=dat;
	while(TI==0);
	TI=0;

}

void main()
{
	InitUart();
	SendByte(0x5a);
	SendByte(0xa5);
	while(1)
	{
		
	}
}

